package us.mooresr.geartrack.client.events;

import com.google.gwt.event.shared.GwtEvent;
import com.google.gwt.event.shared.EventHandler;
import us.mooresr.geartrack.shared.model.Item;
import com.google.gwt.event.shared.HasHandlers;

public class ItemCheckedOutEvent extends
		GwtEvent<ItemCheckedOutEvent.ItemCheckedOutHandler> {

	public static Type<ItemCheckedOutHandler> TYPE = new Type<ItemCheckedOutHandler>();
	private Item item;

	public interface ItemCheckedOutHandler extends EventHandler {
		void onItemCheckedOut(ItemCheckedOutEvent event);
	}

	public ItemCheckedOutEvent(Item item) {
		this.item = item;
	}

	public Item getItem() {
		return item;
	}

	@Override
	protected void dispatch(ItemCheckedOutHandler handler) {
		handler.onItemCheckedOut(this);
	}

	@Override
	public Type<ItemCheckedOutHandler> getAssociatedType() {
		return TYPE;
	}

	public static Type<ItemCheckedOutHandler> getType() {
		return TYPE;
	}

	public static void fire(HasHandlers source, Item item) {
		source.fireEvent(new ItemCheckedOutEvent(item));
	}
}
